#!/usr/bin/env python
# -*- coding: utf-8 -*-
# from dataset.ctw1500_text import Ctw1500Text,CTW1500_Generator,CTW1500_train_dataset_creator
import mindspore.dataset as ds
import mindspore.ops as ops
from mindspore import Tensor, Parameter, context
import mindspore
from mindspore.common.initializer import initializer, XavierUniform,Constant
import os

import numpy as np

# from util.config import config as cfg

# dataset=CTW1500_train_dataset_creator()
# epochs = 2
# ds_iter = dataset.create_tuple_iterator(output_numpy=True, num_epochs=epochs)
# for _ in range(epochs):
#     for _,(img, train_mask, tr_mask, tcl_mask, radius_map, sin_map, cos_map, gt_roi) in enumerate(ds_iter):
#         print(len(img),img.shape, train_mask.shape, tr_mask.shape, tcl_mask.shape, radius_map.shape, sin_map.shape, cos_map.shape, gt_roi.shape)



# means = (0.485, 0.456, 0.406)
# stds = (0.229, 0.224, 0.225)

# transform = Augmentation(
#     size=640, mean=means, std=stds
# )

# trainset = Ctw1500Text(
#     data_root='/home/data/zby22/ms_DRRG/data/ctw1500',
#     is_training=True,
#     transform=transform
# )
# img, train_mask, tr_mask, tcl_mask, radius_map, sin_map, cos_map, meta = trainset[925]


    

# input_x = Tensor(np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]), mindspore.float32)
# input_perm = (0, 2, 1)
# output1 = ops.transpose(input_x, input_perm)
# print(output1)


# input_x = Tensor(np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]), mindspore.float32)
# input_perm = (0, 2, 1)
# output2=input_x.transpose(input_perm)
# print(output2)



# a=tensor1 = initializer(Constant(3), [1, 2, 3], mindspore.float32)
# print(tensor1)

# x = Tensor(np.random.randn(3, 4, 5, 6).astype(np.float32))

# a=(3, 0, 1, 2)
# x=x.transpose(a)

# print(x.shape)

a=mindspore.Tensor([3],mindspore.uint8)
print(a)
b=a.astype(mindspore.float32)
print(a)
print(b)

